package com.qiangqiang.task.server.controller;

import com.qiangqiang.task.server.service.RankingService;
import com.qiangqiang.task.server.util.ResultVOUtil;
import com.qiangqiang.task.server.vo.ResultVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: task
 * @description:
 * @author: Sky.lin
 * @create: 2019-02-13 16:18
 **/
@RestController
@RequestMapping(value = "/ranking")
public class RankingController {

    @Autowired
    RankingService rankingService;

    @GetMapping("/findTopNUser")
    public ResultVO findTopNUser(@Param("n") int n) {
        return ResultVOUtil.success(rankingService.getTopNUser(n));
    }

    @GetMapping("/findUserRanking")
    public ResultVO findUserRanking(@Param("userId") long userId){
        return ResultVOUtil.success(rankingService.getUserRanking(userId));
    }
}
